﻿namespace Borg.AddOn
{
    internal sealed class ComposerNotificationHookChain : IComposerNotificationHook
    {
        private readonly IComposerNotificationHook[] _hooks;

        public ComposerNotificationHookChain(IComposerNotificationHook[] hooks)
        {
            _hooks = hooks;
        }

        public void OnUnplugFinished(Slot slot, Plug plug)
        {
            foreach (IComposerNotificationHook hook in _hooks)
                hook.OnUnplugFinished(slot, plug);
        }

        public void OnUnplugStarted(Slot slot, Plug plug)
        {
            foreach (IComposerNotificationHook hook in _hooks)
                hook.OnUnplugStarted(slot, plug);
        }

        public void OnUntagFinished(Slot slot, Plug plug, string tag)
        {
            foreach (IComposerNotificationHook hook in _hooks)
                hook.OnUntagFinished(slot, plug, tag);
        }

        public void OnUntagStarted(Slot slot, Plug plug, string tag)
        {
            foreach (IComposerNotificationHook hook in _hooks)
                hook.OnUntagStarted(slot, plug, tag);
        }
    }
}
